resource "alicloud_rds_parameter_group" "default" {
  engine         = "mysql"
  engine_version = "8.0"
  param_detail {
    param_name  = "sql_mode"
    param_value = "4000"
  }
  param_detail {
    param_name  = "wait_timeout"
    param_value = "86460"
  }

  parameter_group_name = "test1234"
  parameter_group_desc = "test1234"
}

resource "alicloud_db_instance" "example" {
  engine               = "MySQL"
  engine_version       = "8.0"
  instance_type        = "rds.mysql.s2.large"
  instance_storage     = "30"
  instance_charge_type = "Postpaid"
  instance_name        = "ebike"
  vswitch_id           = var.vswitch_id
  zone_id              = var.zone_id
  monitoring_period    = "60"
  security_ips         = ["127.0.0.1", "10.168.1.12", "100.69.7.112"]
}

resource "alicloud_db_backup_policy" "this" {
  instance_id                 = alicloud_db_instance.example.id
  backup_retention_period     = 7
  preferred_backup_time       = "02:00Z-03:00Z"
  preferred_backup_period     = ["Monday", "Wednesday"]
  log_backup_retention_period = 7
  enable_backup_log           = true
}